<%@ page language="java"
         import="com.ruohi.manage.DBType,com.ruohi.manage.PoolManager,com.ruohi.util.common.CommonDate,com.ruohi.util.common.CommonForm,com.ruohi.util.common.CommonString"
         pageEncoding="UTF-8" %>
<%@ page import="com.ruohi.util.common.Env" %>
<%@ page import="com.ruohi.util.dbutil.DBHelper" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.TreeMap" %>
<%
	Connection connection = null;
	DBHelper dbHelper = DBHelper.getInstance();
	Map model = new HashMap();
	String tableName = "gift_product_comment";
	try{
		connection = PoolManager.getConnection(DBType.getDBTypeByEnum("106013"));
		String id = CommonString.getFormatPara(request.getParameter("id"));
		if(null!=id&&!"".equals(id)){
			model = dbHelper.getMap(" select id,add_user,add_date,pub_date,uuid,mem_no,order_date,key_param_value,comment_grade,comment,comment_explain,comment_explain_date,is_show,product_no,(select name from gift_product where gift_product_comment.product_no=gift_product.no) as product_name from "+tableName+" where uuid = ? ",new Object [] {id} , connection);
		}
		
		Map gradeMap = new TreeMap();
		gradeMap.put("1", "1分");
		gradeMap.put("2", "2分");
		gradeMap.put("3", "3分");
		gradeMap.put("4", "4分");
		gradeMap.put("5", "5分");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=Env.getInstance().getProperty("project_name") %></title>
<link rel="stylesheet" type="text/css" href="/plugin/other/highslide/highslide.css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
	.formLeft {
		text-align: right;
	}
	
	.formRight {
		margin-left: 20px;
		text-align: left;
	}
</style>
</head>

<body style="margin: 0;padding: 0;">
<form name="theform" id="theform" action="/backend/action/crud.jsp?enumNo=106013">
  <div class="formDiv">
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">评论详情</span> </div>
    <div class="formLeft">评论人</div>
    <div class="formRight" style="width:190px">
    	<input type="text" dataType='Require' msg='评论人不能为空！' class="jr_text" id="zd_mem_no" name="zd_mem_no" value="<%=CommonString.getFormatPara(model.get("mem_no")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">评论时间</div>
    <div class="formRight" style="width:190px">
    	<input type="text" class="Wdate jr_text" style="width:160px;" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" name="zd_pub_date" id="zd_pub_date" value="<%=CommonDate.getFormatDate("yyyy-MM-dd HH:mm:ss",model.get("pub_date")) %>" />
    </div>
    <div style="clear:left;"></div>
    
    <div class="formLeft">评论商品</div>
    <div class="formRight" style="width:400px">
    	<%
    		if(id.equals("")){
    			String product_no = CommonString.getFormatPara(request.getParameter("product_no"));
    			Map pMap = dbHelper.getMap("select name from gift_product where no='"+product_no+"'", connection);
    			if(pMap!=null){
    	%>
        <a target="_blank"
           href="http://www.52sdskj.com/goods/<%=product_no %>.htm"><%=CommonString.getFormatPara ( pMap.get ( "name" ) ) %>
        </a>
    	<%
    			}
    		}else{
    	%>
        <a target="_blank"
           href="http://www.52sdskj.com/goods/<%=CommonString.getFormatPara(model.get("product_no")) %>.htm"><%=CommonString.getFormatPara ( model.get ( "product_name" ) ) %>
        </a>
    	<%
    		}
    	%>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">评分</div>
    <div class="formRight" style="width:400px">
      <%=CommonForm.createRadio(gradeMap, (CommonString.getFormatInt(model.get("comment_grade"))==0 ? "5" : CommonString.getFormatInt(model.get("comment_grade")).toString()), "zd_comment_grade") %>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">评论详情</div>
    <div class="formRight" style="width:400px;height:80px;">
    	<textarea class="jr_textarea" dataType='Require' msg='评论详情不能为空！' id="zd_comment" name="zd_comment" style="width:400px; height:80px;"><%=CommonString.getFormatPara(model.get("comment")) %></textarea>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">是否显示</div>
    <div class="formRight" style="width:190px">
      <%=CommonForm.createIsRadio(CommonString.getFormatPara(model.get("is_show")), "zd_is_show") %>
    </div>
    <div style="clear:left; border-bottom: 1px solid #EEE; margin:10px;"></div>
    <div class="formLeft">回复</div>
    <div class="formRight" style="width:400px;height:80px;">
      <textarea class="jr_textarea" style="width:400px; height:80px" name="zd_comment_explain" id="zd_comment_explain"><%=CommonString.getFormatPara(model.get("comment_explain")) %></textarea>
    </div>
    <div style="clear:left;"></div>
  </div>
  <input type="hidden" name="tableName" id="tableName" value="<%=tableName %>" />
  <input type="hidden" name="zd_id" id="zd_id" value="<%=CommonString.getFormatPara(model.get("id")) %>" />
  <%
  	if(id.equals("")){
  %>
  <input type="hidden" name="zd_product_no" id="zd_product_no" value="<%=CommonString.getFormatPara(request.getParameter("product_no")) %>" />
  <%
  	}
  %>
</form>
</body>
</html>
<script type="text/javascript" src="/plugin/jquery/jquery.form.js"></script>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js?tab" type="text/javascript"></script>
<script src="/plugin/date/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="/plugin/validator/wofoshan/validator.min.js" type="text/javascript"></script>
<script type="text/javascript">
	function doSub(dialog){
		var rs = Validator.Validate(document.getElementById("theform"),1);
		if(rs){
			jQuery("#theform").ajaxSubmit({
				type : "POST",
				async : false ,
				success : function(data) {
					var rs = parseInt(jQuery.trim(data), 10);
					if (rs > 0 ) {
						window.parent.jQuery.ligerDialog.success("保存成功！", "提示", function(){
							dialog.close();
						});
					} 
				}
			});
		}
	}
</script>
<%
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		DBHelper.freeConnection(connection);
	}
%>